Conversation
📝 WalkthroughWalkthrough프로젝트에 OSLog.framework를 추가하고 수동 코드 서명으로 설정을 변경했으며, 중앙화된 로깅(CherrishLogger)과 오류형(CherrishError)을 도입하고 TestViewModel의 print 호출을 새 로거로 교체했습니다. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant ViewModel
participant CherrishLogger
participant OSLogFramework as OSLog
ViewModel->>CherrishLogger: debug("로거 테스트")
activate CherrishLogger
CherrishLogger->>CherrishLogger: format message (timestamp, file, func)
alt Debug mode or allowed in release
CherrishLogger->>OSLog: os_log(message, level)
else Suppressed in release
note right of CherrishLogger `#fef3c7`: 로그 출력 생략
end
deactivate CherrishLogger
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45분 Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 Fix all issues with AI agents
In @Cherrish-iOS/Cherrish-iOS.xcodeproj/project.pbxproj:
- Around line 280-286: The project file now forces manual signing
(CODE_SIGN_STYLE = Manual) and sets specific signing keys
(CODE_SIGN_IDENTITY[sdk=iphoneos*], DEVELOPMENT_TEAM,
"DEVELOPMENT_TEAM[sdk=iphoneos*]") and development asset paths; revert to a
team-agnostic, CI-friendly setup by either restoring CODE_SIGN_STYLE = Automatic
and clearing DEVELOPMENT_TEAM/PROVISIONING entries or, if manual signing is
required, document and commit instructions to ensure every developer and CI has
the named provisioning profile (cherrish-development) and certificate installed;
update project.pbxproj to remove hardcoded team IDs and provisioning settings or
add commentary for maintainers and then verify by producing a short confirmation
that the change allows other devs and CI to build ([request_verification]).
- Around line 9-11: Remove the explicit OSLog.framework linking entries from the
Xcode project: delete the PBXBuildFile entry with id 5126F89F2F0E9AF000E67E33
(the "OSLog.framework in Frameworks" build file), remove the corresponding
PBXFileReference with id 5126F89E2F0E9AF000E67E33 (the OSLog.framework file
reference) and any references to that fileRef inside PBXFrameworksBuildPhase or
other sections (the other occurrences noted in the comment). OSLog is provided
by the SDK and only requires import OSLog in source; after removing those
entries ensure there are no dangling references and run a clean build to verify
the project still compiles successfully.
In @Cherrish-iOS/Cherrish-iOS/Core/CherrishError.swift:
- Around line 39-40: The case .unknownError in CherrishError.errorDescription
currently returns nil; change it to return a sensible default string (e.g., "알 수
없는 오류" or "Unknown error") so errorDescription never yields nil for
unknownError; update the switch in the errorDescription computed property for
the CherrishError enum to return that default message for the .unknownError
case.
- Line 10: The enum CherrishError is implicitly internal but should be exported;
change its declaration from "enum CherrishError: Error, LocalizedError,
Equatable" to "public enum CherrishError: Error, LocalizedError, Equatable" so
the type (and any public cases or members) is usable outside the module, and
update any nested members or associated values to appropriate access levels if
needed.
In @Cherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift:
- Line 18: LogType and CherrishLogger are currently implicitly internal and need
to be usable across the module boundary; change their declarations to public by
adding the public access modifier to the enum LogType and the CherrishLogger
type (and any related declarations at the other occurrence referenced) so they
are exported from the module; ensure any methods, initializers, or nested types
that must be accessed externally are also marked public as needed.
- Line 108: The current code sets fileName using the compiler literal (#file)
which always yields "CherrishLogger.swift"; change it to use the incoming file
parameter so the caller's filename is logged by replacing let fileName = (#file
as NSString).lastPathComponent with code that derives fileName from the function
parameter (e.g., let fileName = (file as NSString).lastPathComponent), and
ensure the variable 'fileName' is used downstream in the log output.
- Line 11: The static property subsystem currently force-unwraps
Bundle.main.bundleIdentifier (static let subsystem =
Bundle.main.bundleIdentifier!), which can crash in tests or environments without
a bundle identifier; change subsystem to safely unwrap with a fallback (e.g.,
use optional coalescing or a computed property that returns
Bundle.main.bundleIdentifier ?? "com.cherrish.unknown" or similar) so it never
force-unwraps and always provides a safe default value.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
Cherrish-iOS/Cherrish-iOS.xcodeproj/project.pbxprojCherrish-iOS/Cherrish-iOS/Core/CherrishError.swiftCherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swiftCherrish-iOS/Cherrish-iOS/Presentation/Feature/TestViewModel.swift
🧰 Additional context used
🧬 Code graph analysis (1)
Cherrish-iOS/Cherrish-iOS/Presentation/Feature/TestViewModel.swift (1)
Cherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift (1)
debug(131-137)
🔇 Additional comments (3)
Cherrish-iOS/Cherrish-iOS/Presentation/Feature/TestViewModel.swift (1)
21-21: print를 로거로 교체한 것은 좋습니다!중앙화된 로깅 시스템을 사용하도록 변경한 것은 좋은 개선입니다. 이를 통해 로그 레벨, 카테고리, 타임스탬프를 일관되게 관리할 수 있습니다.
Cherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift (2)
86-91: DateFormatter를 static let으로 선언한 것은 좋은 최적화입니다.DateFormatter 생성 비용이 높기 때문에 재사용하는 것은 성능상 좋은 선택입니다.
80-84: 릴리즈 모드에서 에러만 로깅하는 전략이 적절합니다.프로덕션 환경에서는 에러만 로깅하고 디버그 로그를 제외하는 것은 성능과 프라이버시 측면에서 좋은 접근 방식입니다.
| "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | ||
| CODE_SIGN_STYLE = Manual; | ||
| CURRENT_PROJECT_VERSION = 1; | ||
| DEVELOPMENT_ASSET_PATHS = ""; | ||
| DEVELOPMENT_TEAM = CG37U6CMKP; | ||
| DEVELOPMENT_TEAM = ""; | ||
| "DEVELOPMENT_TEAM[sdk=iphoneos*]" = CG37U6CMKP; | ||
| ENABLE_PREVIEWS = YES; |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
수동 코드 서명 설정을 확인하세요.
코드 서명 방식이 Automatic에서 Manual로 변경되었고, 개발 팀 및 프로비저닝 프로파일이 설정되었습니다. 이러한 변경사항은:
- 다른 팀 멤버들의 로컬 빌드에 영향을 줄 수 있습니다
- CI/CD 파이프라인 설정과 일치해야 합니다
- 프로비저닝 프로파일(
cherrish-development)이 모든 개발자의 Xcode에 설치되어 있어야 합니다
팀 전체가 동일한 프로비저닝 프로파일과 인증서에 액세스할 수 있는지 확인하세요.
Also applies to: 302-303
🤖 Prompt for AI Agents
In @Cherrish-iOS/Cherrish-iOS.xcodeproj/project.pbxproj around lines 280 - 286,
The project file now forces manual signing (CODE_SIGN_STYLE = Manual) and sets
specific signing keys (CODE_SIGN_IDENTITY[sdk=iphoneos*], DEVELOPMENT_TEAM,
"DEVELOPMENT_TEAM[sdk=iphoneos*]") and development asset paths; revert to a
team-agnostic, CI-friendly setup by either restoring CODE_SIGN_STYLE = Automatic
and clearing DEVELOPMENT_TEAM/PROVISIONING entries or, if manual signing is
required, document and commit instructions to ensure every developer and CI has
the named provisioning profile (cherrish-development) and certificate installed;
update project.pbxproj to remove hardcoded team IDs and provisioning settings or
add commentary for maintainers and then verify by producing a short confirmation
that the change allows other devs and CI to build ([request_verification]).
|
|
||
| import Foundation | ||
|
|
||
| enum CherrishError: Error, LocalizedError, Equatable { |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
접근 제어자를 명시하세요.
이 에러 타입이 프로젝트 전체에서 사용될 것으로 보이므로, public enum CherrishError로 명시적으로 선언하는 것이 좋습니다. 현재 암시적 internal 접근 제어는 모듈 외부에서 사용할 수 없습니다.
♻️ 제안하는 수정
-enum CherrishError: Error, LocalizedError, Equatable {
+public enum CherrishError: Error, LocalizedError, Equatable {🤖 Prompt for AI Agents
In @Cherrish-iOS/Cherrish-iOS/Core/CherrishError.swift at line 10, The enum
CherrishError is implicitly internal but should be exported; change its
declaration from "enum CherrishError: Error, LocalizedError, Equatable" to
"public enum CherrishError: Error, LocalizedError, Equatable" so the type (and
any public cases or members) is usable outside the module, and update any nested
members or associated values to appropriate access levels if needed.
| static let error = OSLog(subsystem: subsystem, category: "Error") | ||
| } | ||
|
|
||
| enum LogType { |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
LogType과 CherrishLogger의 접근 제어자를 명시하세요.
이 타입들이 프로젝트 전체에서 사용되므로 public으로 선언해야 합니다. 현재 암시적 internal 접근 제어는 모듈 외부에서 사용할 수 없습니다.
♻️ 제안하는 수정
-enum LogType {
+public enum LogType {
case network
case debug
case data
case error(error: Error)
// ...
}
-struct CherrishLogger {
+public struct CherrishLogger {
// ...
}Also applies to: 71-71
🤖 Prompt for AI Agents
In @Cherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift at line 18, LogType and
CherrishLogger are currently implicitly internal and need to be usable across
the module boundary; change their declarations to public by adding the public
access modifier to the enum LogType and the CherrishLogger type (and any related
declarations at the other occurrence referenced) so they are exported from the
module; ensure any methods, initializers, or nested types that must be accessed
externally are also marked public as needed.
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Fix all issues with AI agents
In @Cherrish-iOS/Cherrish-iOS.xcodeproj/project.pbxproj:
- Line 10: The PBX file contains an explicit PBXFileReference for
OSLog.framework (the entry with name = OSLog.framework and path =
System/Library/Frameworks/OSLog.framework) and an associated Frameworks group
that are unnecessary; remove that PBXFileReference and any references to the
Frameworks group (the Frameworks group block that lists OSLog.framework and
related entries) from the project.pbxproj so OSLog is used via import OSLog only
and not explicitly linked in the project.
In @Cherrish-iOS/Cherrish-iOS/Core/CherrishError.swift:
- Around line 10-19: The enum CherrishError should be explicitly exported:
change the declaration of CherrishError to be public so it can be used across
the project (i.e., make the type public by updating the declaration for enum
CherrishError to include the public access modifier while keeping its existing
cases like DIFailedError, decodingError, URLError, networkRequestFailed,
networkConnect, networkError(code:message:), noData, unknownError, and
encodingError).
In @Cherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift:
- Line 11: The forced unwrap of Bundle.main.bundleIdentifier in the static let
subsystem constant is unsafe and can crash in tests or certain environments;
change the initializer for subsystem in CherrishLogger (static let subsystem) to
handle the optional safely — e.g., use nil-coalescing to a sensible default
identifier or fallback to another safe source
(Bundle.main.object(forInfoDictionaryKey: "CFBundleIdentifier") as? String ??
"com.cherrish.unknown"), or compute it lazily and guard-fail with a default, so
no forced unwrap remains.
- Around line 147-153: Change the static func error to accept an optional
message parameter (e.g., message: String = "") and pass that message into the
existing log call instead of the empty string; update the log handling for the
.error(error: Error) case inside log(...) to include and format both the
provided message and error.localizedDescription (so the log output shows the
custom context message plus the error details). Ensure you update the signature
of CherrishLogger.error and the .error case handling code paths that construct
the final log string.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
Cherrish-iOS/Cherrish-iOS.xcodeproj/project.pbxprojCherrish-iOS/Cherrish-iOS/Core/CherrishError.swiftCherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift
🔇 Additional comments (6)
Cherrish-iOS/Cherrish-iOS/Core/CherrishError.swift (1)
21-42: LGTM!
errorDescription구현이 잘 되어 있습니다. 모든 케이스에 대해 명확한 한국어 메시지를 제공하며, 이전 리뷰에서 지적된unknownError의nil반환 문제도 해결되었습니다.Cherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift (5)
86-91: LGTM!
DateFormatter를static let으로 선언하여 인스턴스를 재사용하는 것은 좋은 패턴입니다.en_US_POSIXlocale 설정도 날짜 포맷 일관성을 보장합니다.
106-108: 파일명 로깅 버그가 수정되었습니다.이전 리뷰에서 지적된
#file대신file파라미터를 사용하도록 수정되었습니다. 이제 호출한 파일의 실제 이름이 로그에 정상적으로 표시됩니다.
123-145: LGTM!
network,debug,data함수들이 일관된 시그니처로 잘 구현되어 있습니다.#file과#function기본값을 사용하여 호출 위치를 자동으로 캡처하는 패턴이 적절합니다.
71-71: CherrishLogger의 접근 제어자를 명시하세요.프로젝트 전체에서 사용되는 로거이므로
public struct CherrishLogger로 명시적으로 선언하는 것이 좋습니다.Likely an incorrect or invalid review comment.
18-18: LogType의 접근 제어자를 명시하세요.이 타입이 다른 모듈에서 사용될 경우
public으로 선언해야 합니다.Likely an incorrect or invalid review comment.
| objects = { | ||
|
|
||
| /* Begin PBXFileReference section */ | ||
| 5126F89E2F0E9AF000E67E33 /* OSLog.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OSLog.framework; path = System/Library/Frameworks/OSLog.framework; sourceTree = SDKROOT; }; |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
OSLog.framework 명시적 링크가 불필요합니다.
OSLog는 iOS 10부터 사용 가능한 시스템 프레임워크로, import OSLog만으로 사용할 수 있습니다. 프로젝트에 명시적으로 링크할 필요가 없으며, 이 참조와 관련된 Frameworks 그룹(lines 46-53)을 제거해도 됩니다.
🤖 Prompt for AI Agents
In @Cherrish-iOS/Cherrish-iOS.xcodeproj/project.pbxproj at line 10, The PBX file
contains an explicit PBXFileReference for OSLog.framework (the entry with name =
OSLog.framework and path = System/Library/Frameworks/OSLog.framework) and an
associated Frameworks group that are unnecessary; remove that PBXFileReference
and any references to the Frameworks group (the Frameworks group block that
lists OSLog.framework and related entries) from the project.pbxproj so OSLog is
used via import OSLog only and not explicitly linked in the project.
| enum CherrishError: Error, LocalizedError, Equatable { | ||
| case DIFailedError | ||
| case decodingError | ||
| case URLError | ||
| case networkRequestFailed | ||
| case networkConnect | ||
| case networkError(code: Int, message: String) | ||
| case noData | ||
| case unknownError | ||
| case encodingError |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
접근 제어자를 명시하세요.
이 에러 타입이 프로젝트 전체에서 사용될 것으로 보이므로, public enum CherrishError로 명시적으로 선언하는 것이 좋습니다.
♻️ 제안하는 수정
-enum CherrishError: Error, LocalizedError, Equatable {
+public enum CherrishError: Error, LocalizedError, Equatable {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| enum CherrishError: Error, LocalizedError, Equatable { | |
| case DIFailedError | |
| case decodingError | |
| case URLError | |
| case networkRequestFailed | |
| case networkConnect | |
| case networkError(code: Int, message: String) | |
| case noData | |
| case unknownError | |
| case encodingError | |
| public enum CherrishError: Error, LocalizedError, Equatable { | |
| case DIFailedError | |
| case decodingError | |
| case URLError | |
| case networkRequestFailed | |
| case networkConnect | |
| case networkError(code: Int, message: String) | |
| case noData | |
| case unknownError | |
| case encodingError |
🤖 Prompt for AI Agents
In @Cherrish-iOS/Cherrish-iOS/Core/CherrishError.swift around lines 10 - 19, The
enum CherrishError should be explicitly exported: change the declaration of
CherrishError to be public so it can be used across the project (i.e., make the
type public by updating the declaration for enum CherrishError to include the
public access modifier while keeping its existing cases like DIFailedError,
decodingError, URLError, networkRequestFailed, networkConnect,
networkError(code:message:), noData, unknownError, and encodingError).
| import OSLog | ||
|
|
||
| extension OSLog { | ||
| static let subsystem = Bundle.main.bundleIdentifier! |
There was a problem hiding this comment.
bundleIdentifier 강제 언래핑이 위험합니다.
Bundle.main.bundleIdentifier!는 유닛 테스트나 특정 환경에서 크래시를 발생시킬 수 있습니다.
🔒 제안하는 수정
- static let subsystem = Bundle.main.bundleIdentifier!
+ static let subsystem = Bundle.main.bundleIdentifier ?? "com.cherrish.unknown"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| static let subsystem = Bundle.main.bundleIdentifier! | |
| static let subsystem = Bundle.main.bundleIdentifier ?? "com.cherrish.unknown" |
🤖 Prompt for AI Agents
In @Cherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift at line 11, The forced
unwrap of Bundle.main.bundleIdentifier in the static let subsystem constant is
unsafe and can crash in tests or certain environments; change the initializer
for subsystem in CherrishLogger (static let subsystem) to handle the optional
safely — e.g., use nil-coalescing to a sensible default identifier or fallback
to another safe source (Bundle.main.object(forInfoDictionaryKey:
"CFBundleIdentifier") as? String ?? "com.cherrish.unknown"), or compute it
lazily and guard-fail with a default, so no forced unwrap remains.
| static func error( | ||
| _ error: Error, | ||
| file: String = #file, | ||
| function: String = #function | ||
| ) { | ||
| log(type: .error(error: error), message: "", file: file, function: function) | ||
| } |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
error 함수의 message 파라미터 사용을 고려하세요.
현재 error 함수는 빈 문자열("")을 message로 전달하고, 내부적으로 error.localizedDescription만 로깅합니다. 추가 컨텍스트 메시지를 함께 기록할 수 있도록 파라미터를 확장하는 것을 고려해보세요.
♻️ 제안하는 수정
static func error(
_ error: Error,
+ message: Any = "",
file: String = #file,
function: String = #function
) {
- log(type: .error(error: error), message: "", file: file, function: function)
+ log(type: .error(error: error), message: message, file: file, function: function)
}그리고 log 함수 내 error 케이스에서:
case .error(let error):
- logger.error("[❌ Error] [Date: \(timestamp)] [\(fileName) -> \(function)]: \(error.localizedDescription)")
+ let contextMessage = logMessage.isEmpty ? "" : "[\(logMessage)] "
+ logger.error("[❌ Error] [Date: \(timestamp)] [\(fileName) -> \(function)]: \(contextMessage)\(error.localizedDescription)")Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In @Cherrish-iOS/Cherrish-iOS/Core/CherrishLogger.swift around lines 147 - 153,
Change the static func error to accept an optional message parameter (e.g.,
message: String = "") and pass that message into the existing log call instead
of the empty string; update the log handling for the .error(error: Error) case
inside log(...) to include and format both the provided message and
error.localizedDescription (so the log output shows the custom context message
plus the error details). Ensure you update the signature of CherrishLogger.error
and the .error case handling code paths that construct the final log string.
wotjs020708
left a comment
There was a problem hiding this comment.
프레임 워크로 모듈화를 하신 거 맞나요?
아뇨 모듈화 안했습니당 |

🔗 연결된 이슈
📄 작업 내용
💻 주요 코드 설명
📚 참고자료
https://ios-development.tistory.com/381